<?php


namespace app\common\caches;


use think\facade\Cache;

class GameCache
{
    public static function setGameByAppId(string $app_id, object $game)
    {
        return Cache::store('redis')->handler()->hset("games.cache", $app_id, serialize($game));
    }

    public static function getGameByAppId(string $app_id)
    {
        $game = Cache::store('redis')->handler()->hget("games.cache", $app_id);
        return unserialize($game);
    }

    public static function delGameByAppId(string $app_id)
    {
        return Cache::store('redis')->handler()->hdel("games.cache", $app_id);
    }
}
